/*
 * @Author       : wfl
 * @LastEditors  : wfl
 * @description  :
 * @updateInfo   :
 * @Date         : 2022-12-15 09:52:50
 * @LastEditTime : 2023-09-05 16:27:50
 */
import type { Ref } from 'vue'
import { EAlign, EFormType } from '@/global/enums/search'
import type { ISearchForm } from '@/global/enums/search'

export const useFields = () => {
  const defKeys = useTableKey()
  const fieldList: Ref<ISearchForm[]> = ref([
    {
      key: 'name',
      value: '',
      label: '部门名称',
      show: true,
      minWidth: 120,
      search: false
    },
    {
      key: 'manager',
      value: '',
      label: '部门主管',
      type: EFormType.select,
      show: true,
      tableSlot: 'manager',
      search: false
    },
    {
      key: 'phone',
      value: '',
      label: '联系电话',
      show: true,
      width: 120,
      search: false
    },
    {
      key: 'userCount',
      value: '',
      label: '用户数量(人)',
      show: true,
      width: 110,
      align: EAlign.right,
      search: false,
      className: 'is-number'
    },
    ...defKeys
  ])

  const tableKeys: Ref<ISearchForm[]> = ref([])

  return {
    fieldList,
    tableKeys
  }
}
